package com.kunchi.oms.order.dao;

import com.kunchi.oms.order.po.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper {
    @Select("select * from `order`")
    List<Order> findAll();

    @Select("select * from `order` where order_status= #{orderStatus} and (#{orderPrice} is null or order_price =#{orderPrice})")
    List<Order> findByStatusAndPrice(Order order);

    @Select({ "INSERT INTO `order` (id,order_number,order_name,order_price,order_status) VALUES (#{id},#{orderNumber}, #{orderName}, #{orderPrice},#{orderStatus})" })
    void add(Order order);

    @Update({"UPDATE `order` SET `order_number`=#{orderNumber}, order_name=#{orderName},order_price=#{orderPrice} WHERE (`id`=#{id})"})
    void update(Order order);

    @Select("select * from `order`  order_status= #{orderStatus}")
    List<Order> ex(Order order);


}
